package org.bongo.open.cumulo.arbitrator;

import org.bongo.open.cumulo.arbitrator.broker.ProcEngineBrokerClient;
import org.bongo.open.cumulo.arbitrator.distribute.MessageDistributor;
import org.bongo.open.cumulo.core.broker.CumuloBrokerBase;
import org.bongo.open.cumulo.core.context.CumuloContext;
import org.bongo.open.cumulo.core.message.MessageDistributable;

/**
 * Implements the Broker service of Conductor Node.
 * 
 * @author smitha
 *
 */
public class Arbitrator {
	
	private ProcEngineBrokerClient computeBrokerClient;
	
	public ProcEngineBrokerClient getProcEngineBrokerClient(@SuppressWarnings("rawtypes") MessageDistributor distributor, @SuppressWarnings("rawtypes") MessageDistributable distributable, CumuloContext context) {
		@SuppressWarnings("unchecked")
		int distributionIndex = distributor.distributeToSlot(distributable, context);
		computeBrokerClient.setDistributionIndex(distributionIndex);
		
		return computeBrokerClient;
	}
	
	public Arbitrator(ProcEngineBrokerClient client) {
		computeBrokerClient = client;
	}
	
}
